home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / misc / prnf246.zip / PRN2BOTH.DOC < prev    next >
Text File  |  1994-07-11  |  22KB  |  354 lines

  1.  
  2. ________PRN2BOTH                                                            v. 2.23
  3.  
  4.  
  5.  
  6. Purpose: Prepares an ASCII text file for printing on both sides of the
  7.          paper by copying it to two files, one containing the odd and the
  8.          other containing the even pages.  Its intended use is on files
  9.          which have been formatted for printing with FF's (the form-feed
  10.          character, ASCII #12) or by the proper number of blank lines to
  11.          fill out the bottom of the page.
  12.  
  13. Format:  PRN2BOTH [[filespec] [/L[#]nn] [/Mnn,nn,nn] [/Rn[,n[,n[,n]]]]]
  14.                            [/A] [/N] [/?]
  15.  
  16.          All you really must enter is PRN2BOTH.  Mostly, what you don't
  17.          specify on the command line will be asked for interactively.
  18.  
  19.          ________         filespec may contain drive and path specs, but not wildcards.
  20.  
  21.          ____         /Lnn specifies the maximum page length.  If a form-feed is found
  22.              in the first page (that is, in the first nn lines), Prn2Both
  23.              will ignore your spec and go by form-feeds.  If none are found
  24.              in the first nn lines, Prn2Both will (a) insert FF's every nn
  25.              lines, and (b) convert any FF's it finds into nulls (ASCII
  26.              #0).  If you do not specify a page length it defaults to 63,
  27.              but you get a chance to change it.
  28.  
  29.              ___________             Note change: page length specifications must now start with
  30.              /L.  (In earlier versions, they just started with /nn.)
  31.  
  32.          ___         /L# says the file is self-paged with blank lines.  In this case,
  33.              Prn2Both inserts no FF's and converts any it finds into nulls.
  34.  
  35.              By itself, /L# gives you 66 lines per page.  Putting a number
  36.              with it: /L#nn tells Prn2Both that the file is designed to
  37.              page itself every nn lines.  Prn2Both will break the pages
  38.              that way, nulling any FF's it finds and inserting no FF's.
  39.                                                               _______             This is not normal practice; it implies that the printer gets
  40.              nn lines per page.  It might be used with a laser printer or
  41.              for a file designed to be printed at 8 lines per inch (88 per
  42.              page) or meant for legal or European paper sizes.
  43.  
  44.          _______         /Mn,n,n three numbers specify the margin layout: the 1st is the
  45.              left margin on odd pages (the right margin on even pages), the
  46.              2nd is the width of the text (If you don't know the width,
  47.              CountPgs will tell you), and the 3rd is the paper width, how
  48.              many columns the printer puts on a line in the font you intend
  49.              to use.  (You must begin this parameter with '/', but you can
  50.              separate the numbers with anything you like except a space.)
  51.  
  52.              "Margin" here means margin added by Prn2Both.  If there is al-
  53.              ready a margin in your text, Prn2Both won't know it, so you
  54.              must take it into account yourself, or remove it with Mangler.
  55.  
  56.          _________         /Rn,n,n,n Reverse header/footer lines on even-numbered pages.  The
  57.              first number says how many header lines and the second how
  58.              many footer lines.
  59. ________PRN2BOTH                                                             Page 2
  60.  
  61.  
  62.              If there's a third number, it will become the width (in col-
  63.              umns) of blank space that will be taken to indicate separate
  64.              header segments.  That third number also adjusts the distance
  65.              between the line ends and the left and right header segments.
  66.              (If more than so many columns are blank at either end of the
  67.              header, Prn2Both will take it there's no end segment on that
  68.              side.)  The default divider width is 4, and the end space is
  69.              always half-again the divider width (rounded down).
  70.  
  71.              If there's a fourth number, Prn2Both will use it for the head-
  72.              er width.  If there isn't a fourth number, headers will be
  73.              presumed to have the same width as the text.  By juggling the
  74.              header and divider widths, you can sometimes perform surgery
  75.              on a header line.
  76.  
  77.              On each page, Prn2Both will set out to reverse as many lines
  78.                                                      _________             as you specified, counting from the top non-blank line on the
  79.              page, but it will stop reversing on that page if it finds a
  80.              blank line first.  It does the same for footers, but counting
  81.              from the bottom non-blank line up.
  82.  
  83.              Even a file that uses headers and footers may contain pages,
  84.              like the title page, that lack them.  If Prn2Both finds no
  85.              text within 6 lines or so of either end of the page, it pre-
  86.              sumes there's no header/footer at that end of that page.  At
  87.              the top of the page, this usually works, but files paged with
  88.              FF's, usually put the FF right after the last line, whether
  89.              it's a footer line or not.  To avoid reversing the last line
  90.              of such a page, you'll have to insert some blank lines between
  91.              the last line (when it's not a footer) and the FF.
  92.  
  93.              The /R option cannot be used if the file has its own margin
  94.              built in, and you get a warning if Prn2Both finds such a mar-
  95.              gin.  If you want to reverse header lines, you should remove
  96.              the margin with Mangler.  It's a good idea to do this anyway;
  97.              it's much easier to explain to Prn2Both what margins you want
  98.              if you don't have to allow for a margin already in the text.
  99.              To find the size of the margin, use CountPgs.
  100.  
  101.          __         /A means "Reverse All."  It reverses lines in all pages instead of
  102.              only in even-numbered ones.  You'd need to do this when the
  103.              lines are reversed wrong (reversed on odds and not on evens),
  104.              as might happen if you add or remove blank pages.  (This op-
  105.              tion is available from the command line, only.)
  106.  
  107.          __         /N means "No split."  It puts all the output into one file,
  108.              XXX.OUT, instead of dividing it between XXX.ODD and XXX.EVN.
  109.              Why?  In the normal case, a text will have, say, page numbers
  110.              in the top right corner, and Prn2Both puts them on the top
  111.              left for even pages only (to keep them always in the outside
  112.              corner).  If a perverse text has the numbers on the top left,
  113.              and you want them on the top right, you can't do it by insert-
  114.                                                                        ___             ing a blank page here or there.  You have to reverse them all,
  115.                               ____             using /N /A, and then divide, reversing the even pages in the
  116.              usual way.  We think of everything.  (This option is available
  117.              from the command line, only.)
  118. ________PRN2BOTH                                                             Page 3
  119.  
  120.  
  121.          __         /? cancels everything else & brings a help screen.
  122.  
  123.          Under the L# option, if the end of the file doesn't come out even
  124.          with the page length specified, Prn2Both will add blank lines to
  125.          even up the end of the last page.  In any case, if XXX.EVN has a
  126.          page less than XXX.ODD, Prn2Both gives it a blank extra page.
  127.  
  128. Remarks: Prn2Both reads the file you specify and outputs two files with the
  129.          same filename and the suffixes ".ODD" and ".EVN".  It puts them in
  130.          the default drive\directory.  Give it C:\DOCS\FOO.DOC, and you'll
  131.          get FOO.ODD and FOO.EVN.  Essentially, you copy FOO.ODD to the
  132.          printer, take the paper out, put it in again other way up, and
  133.          copy FOO.EVN to the printer.  Be careful to make sure that the
  134.          first page in FOO.EVN (it should be the 2nd page) prints on the
  135.          back of page 1 from FOO.ODD.
  136.  
  137.          What Prn2Both does is copy from the source file into the target
  138.          files.  The only characters it notices are the line-feed (LF,
  139.          ASCII #10), form-feed (FF, ASCII #12), and end-of-file (ASCII
  140.          #26).  Whenever it finds an LF, it counts a line.  When it finds a
  141.          form-feed or counts out the page length you specified, it switches
  142.          to the other target file.  End-of-files, it nulls out. Asked to
  143.          insert margins, it will watch for bare carriage-returns (CR, ASCII
  144.          #13) and insert margin spaces after them, too.
  145.  
  146.          Except for its margining feature and its ability to reverse header
  147.          and footer lines, Prn2Both isn't a formatter or paginater.  Given
  148.          a continuous file without page divisions, Prn2Both will break it
  149.          into pages, of course, but they won't be numbered, they'll lack
  150.          headers, footers, top and bottom margins, and you take the page
  151.          breaks you get.  To print a file properly, you need to know cer-
  152.          tain things about it.  How wide are the lines, and do the pages
  153.          already have a margin built in?  That determines what printer font
  154.          you'll want and whether you should set up the printer to add a
  155.          margin.  Prn2Both doesn't give you any such information.  It's
  156.          part of a set, meant to be used together.  These are the other
  157.          programs and (briefly) what they do: (1) PrnSet is a universal
  158.          printer setter.  You need a printer setter, but any will do if it
  159.          fits your printer.  CountPgs sizes up a text file and gets the
  160.          information you need for working with it: whether the file is al-
  161.          ready paginated, the number of pages, their length & width, wheth-
  162.          er it contains tabs, bare CR's, hi-bit characters (graphics for
  163.          instance), etc.  Pagina paginate text files and make headers &/or
  164.          footers.  Finally, Mangler has a miscellany of functions you may
  165.                                                                    ____         need to massage the file into shape.  You usually need to look at
  166.          the file  to to see about headers and such, and you may need to go
  167.          in with an editor to adjust page ends and such.  For looking at
  168.          the file, several free or cheap file viewers are available; the
  169.                                         ____         best of them is Vernon Buerg's List.  The main advantage of a pro-
  170.          gram like that is that you won't inadvertenly alter the file.  If
  171.          you must use an editor, be careful.  It must be able to work with
  172.          plain ASCII files.  Further, if the file contains bare carriage
  173.          returns to make boldface and underline (CountPgs will tell you if
  174.          it does), beware of text editors that remove them or take them for
  175.          newlines.  Editors which leave CR's alone are scarcer than you'd
  176.          think.  Finally, if you want page 1 to be a right hand page, you
  177. ________PRN2BOTH                                                             Page 4
  178.  
  179.  
  180.          may need to insert some extra FF's after the title page and table
  181.          of contents.  The easy way to do it is with an editor if you have
  182.          a suitable one.  In case you don't, both Pagina and Mangler have
  183.          provision for inserting extra blank pages.
  184.  
  185.          Other shareware or public domain programs also handle printing on
  186.          both sides of the page.  Two I know of are BOTH by Peter F. Feld-
  187.          mann and David Birley's BOTHSIDES.  Prn2Both began as a quick-and-
  188.          dirty job to do something they don't (or didn't when I wrote Prn2-
  189.          Both): it's usable on files which make special effects (boldface,
  190.          underline, etc.) by using bare carriage returns or by means of
  191.          special printer instruction codes inserted into the text.  The
  192.          trick is simply to divide lines on LF or FF instead of CR.
  193.  
  194.  
  195. About Margins:
  196.  
  197.          Margins for files printed on both sides of the paper are tricky.
  198.          Sometimes, you can simply center the text in the page.  Usually,
  199.          you want to leave a little more margin on the inside --the left
  200.          side of the odd pages and right of the even ones.  If you mean to
  201.          use small print and put your text onto narrow paper, you use a
  202.          normal margin on the odd pages, but you must put enough margin on
  203.          the even pages to push the text all the way over --the margin you
  204.                                              _____         really care about is the one on the right side of the even pages.
  205.          To work it out, you need to know (1) how much left margin you
  206.          want, (2) how wide the text is (CountPgs will tell you) and (3)
  207.          how wide the paper is (that is, how many characters per line the
  208.          printer will put in the font you're going to use).  Prn2Both will
  209.          ask you for these numbers and do the arithmetic for you.  You en-
  210.          ter the figures in the boxes and then press Ctrl-Enter to move
  211.          along.  It will start you with the default figures: 0 margin, 80
  212.          column text width, 80 column paper width.
  213.  
  214.          If you don't want to add margins (if you've set everything cor-
  215.          rectly with Pagina, for instance), you can just leave the default
  216.                                           _____         width values alone, provided you don't ask for reversed headers.
  217.          (In such a case, any setting will do, so long as margin = 0 and
  218.          text width = paper width.)  If you want to reverse headers or
  219.          footers, however, it's important (a) that there be no margin al-
  220.          ready in the text and usually (b) that Prn2Both know the true
  221.          width of the header (it can correct for an underestimate, but not
  222.          for an overestimate).  If either of these is incorrect, you may
  223.          get some peculiar headers.  If you call for a reversed header from
  224.          the menu, you'll be asked for the header width.
  225.  
  226.          Both Pagina and Prn2Both can make margins.  If you have an unpag-
  227.          inated file to print, you'll want to run it through Pagina, any-
  228.          way, and maybe jigger the result with an editor.  It's probably
  229.          better to do the margin making with Pagina, because you can set
  230.          them up with the rest of the header and formatting instructions in
  231.          the .HDR file.  If your file is already paginated, however, you'll
  232.          need to do the margining with Prn2Both.
  233. ________PRN2BOTH                                                             Page 5
  234.  
  235.  
  236. Sheet-Feeders & Page Order:
  237.  
  238.  
  239.          If your printer has to stack the pages print side up (e.g. HP's
  240.          Desk Jet), it will collate backwards.  Reversing the order of the
  241.          pages before printing fixes it.  Backwards backwards is forwards.
  242.  
  243.          To print on both sides of the paper, after Prn2Both has split the
  244.          file into odd and even paged files is simple enough on the usual
  245.          dot-matrix printer that uses continuous-feed paper.  If you make
  246.          sure to leave an extra sheet at the beginning of the text it's
  247.          pretty inuitive to turn the paper around so the first page of the
  248.          second file goes on the back of the first page of the first file.
  249.          With a sheet-feeder, however, it's a little tricky.
  250.  
  251.          If the printer must stack its output print side up, as the HP Desk
  252.          Jets do, printing even on one side is complicated.  A straight run
  253.          leaves you with a backwards-collated printout.  Prn2Both has no-
  254.          thing for you, of course, but Mangler can reverse the order of
  255.          pages in a file.  Stacking a reversed file print side up leaves
  256.          you with page 1 on top, facing up.  To print on both sides of the
  257.                                                 ___         paper with such a printer, reverse the odd paged file but not the
  258.          even paged file.  Print either of them, turn the paper around so
  259.          it goes in head first, and print the other file on the back.  (Re-
  260.                                            ______         member: the new print goes on the bottom of the paper as it lies
  261.          in the feeder tray).
  262.  
  263.          If the printer does collate properly by stacking the output print
  264.          side down, you don't need to reverse a file.  It is important,
  265.          however, to print the even pages first and the odd pages on the
  266.          back.
  267.  
  268.                                                               ___         I don't know of a printer that puts the print on the top of the
  269.          paper as it comes in.  If yours does, of course you'll have to re-
  270.          verse the instructions above.  More or less.
  271.  
  272.  
  273. A Note About Colors:
  274.  
  275.          PrnSet (2.80 and later) has an option to customize its colors.
  276.          (From PrnSet's main menu, press F3.)  If PRN2BOTH.EXE is on the
  277.          default drive & directory when you run PrnSet's color changer, it
  278.          will change Prn2Both's colors to match.
  279.  
  280.          Lacking a copy of PrnSet, if you know how to use DEBUG or a disk
  281.          editor (like Peter Norton's NU), you can change the bytes in the
  282.                                                           ___________         file directly.  Search for the flag, "COLORS:".  Immediately after
  283.          the colon are 4 bytes specifying colors, in this order: Normal,
  284.          Emphasized, Frame, and Reversed.  To set up for black-and-white, I
  285.          suggest you make them (in hex numbers): 07 0F 07 70 for white-on-
  286.          black, bright-white-on-black, white-on-black, black-on-white.
  287. ________PRN2BOTH                                                             Page 6
  288.  
  289.  
  290. Version History:
  291.  
  292.          1.10  (July, l989) adds margining.  Smarter & slower.
  293.  
  294.          1.20a (Aug, 1988) allows all parameters including margins to be
  295.                entered at the command line.  Smoothed interaction some.
  296.                Yes, there was a plain Prn2Both 1.20, but unfortunately, a
  297.                copy er, um, escaped prematurely.
  298.  
  299.          2.00  (Dec, 1989) allows even-page headers to be reversed.  Now
  300.                thinks lines & pp instead of chars.  Smarter & slower.
  301.  
  302.                2.00a (posthaste) fixes small bugs in output of odd lines
  303.                (bare FF's and such) & a memory management bug that caused
  304.                2.00 to refuse to run except on my (former) test files.
  305.                2.00b improves centering in headers & footers & limits head-
  306.                er and footer reversing to lines near the ends of the page.
  307.                2.00c fixes errors in paging with reversed footers and also
  308.                (I think) a nasty little intermittent loop.
  309.  
  310.          2.01  (Still Dec, 1989) adds options /A (reverse header lines on
  311.                _               All pages instead of only on even numbered ones) and /N (do
  312.                _               Not Split the file).  Another swat at that nasty little in-
  313.                termittent loop.  2.01a has a better line-reversing algo-
  314.                rithm.  Everything not abutting the line ends is clumped in-
  315.                to a single center segment.  2.01c stops better (less likely
  316.                to hang on Ctrl-Break).  2.01d (Mar, 1990) reverses properly
  317.                around a 1-chat center section.
  318.  
  319.          2.10  (Apr, 1990) (1) allows choice of divider width for header
  320.                sections, and (2) asks for header width if reverse headers
  321.                requested from the menu.  2.10a (June, 1990) fixes bug about
  322.                ragged files.  2.10c (April, 1991) makes the command line /M
  323.                and /R work properly.  (I forget what 2.10b did.)
  324.  
  325.          2.11  (Jan, 1992) Makes use of a new line-reading function.  If
  326.                all's well  you'll never notice, but changing the version
  327.                number makes it easier to keep track of bugs.
  328.  
  329.          2.20  (June, 1992)  Makes use of that function properly.  Now,
  330.                Prn2Both can handle lines of up to about 3000 characters.
  331.                Formerly, it was limited to lines of 255 characters (includ-
  332.                ing segments with underlining &c following bare CR's).  Also
  333.                has a bug fix about 0 margin specified on the command line.
  334.  
  335.          2.21  (Oct, 1992) Bug: Turbo Pascal's reset balks at read-only
  336.                non-text files.  Works around that by using text files or
  337.                temporarily changing attribute of file.  2.2la (Dec, 1992)
  338.                uses a better way to read read-only files.  2.21b (Feb,
  339.                1993) fixes bug in margins for 1-char lines.
  340.  
  341.          2.22  (July, 1993) Added help screen on /? parameter.
  342. ________PRN2BOTH                                                             Page 7
  343.  
  344.  
  345.  
  346.          2.23  (July, 1994) Finally fixed divider: to specifying divider
  347.                width of 3 now gets you a 3-col divider space instead of 4.
  348.                Also, now works on 43 & 50 line screens.
  349.  
  350.  
  351.  
  352.                                                     R. N. Wisan, July, l994
  353.                                         37 Clinton Street, Oneonta NY 13820
  354.                                               internet: wisanr@hartwick.edu